Socket
Socket
Sign inDemoInstall

unicode-loose-match

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    unicode-loose-match

A JavaScript implementation of Unicode loose matching.


Version published
Weekly downloads
3
Maintainers
1
Install size
87.3 kB
Created
Weekly downloads
 

Readme

Source

unicode-loose-match

unicode-loose-match is a JavaScript implementation of UAX44-LM3, i.e. the loose matching algorithm for symbolic values as defined in the Unicode Standard.

It’s based on Unicode data and recognizes property aliases and property value aliases.

Installation

To use unicode-loose-match programmatically, install it as a dependency via npm:

$ npm install unicode-loose-match

Then, require it:

const matchLoosely = require('unicode-loose-match');

API

This module exports a single function named matchLoosely.

matchLoosely(propertyInput, [valueInput])

This function takes two strings propertyInput and valueInput and applies loose matching on the property-value pair within the list of all Unicode property values. valueInput is optional.

The return value is an object containing containing the canonical property name property and the canonical property value name value. If an unknown propertyInput is given, an exception is thrown.

// Find the canonical property name and property value name:
matchLoosely('blk', 'Arabic_PF_B')
// → { 'property': 'Block', 'value': 'Arabic_Presentation_Forms_B' }

// Find the canonical property name:
matchLoosely('compex')
// → { 'property': 'Full_Composition_Exclusion' }

Author

twitter/mathias
Mathias Bynens

License

unicode-loose-match is available under the MIT license.

Keywords

FAQs

Last updated on 18 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc